package com.surveillance.tests;

import java.util.ArrayList;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.surveillance.BO.BOLayer;
import com.surveillance.BO.SalleBO;
import com.surveillance.entities.Agenda;
import com.surveillance.entities.Etudiant;
import com.surveillance.entities.Salle;
import com.surveillance.util.SalleEtudiantTuple;

public class TestAffectationEleves {
	public static void main(String[] args) {
		ApplicationContext appContext = new ClassPathXmlApplicationContext(
				"beanLocations.xml");
		BOLayer<Salle> salleBO = (BOLayer<Salle>) appContext.getBean("SalleBO");
		BOLayer<Etudiant> etudiantBO = (BOLayer<Etudiant>) appContext
				.getBean("EtudiantBO");

		/*
		 * ArrayList<Etudiant> allStudents = new
		 * ArrayList<Etudiant>(etudiantBO.findAll());
		 * System.out.println("printing all students"); for(int
		 * i=0;i<allStudents.size();i++){
		 * System.out.println(allStudents.get(i));
		 * 
		 * }
		 */

		ArrayList<Salle> allSalles = new ArrayList<Salle>(salleBO.findAll());
		ArrayList<SalleEtudiantTuple> affectedStudents = ((SalleBO) salleBO)
				.affectationEtudiant(1, true, allSalles);
		System.out.println("affichage des tuples");
		for (int i = 0; i < affectedStudents.size(); i++) {
			System.out.println(affectedStudents.get(i));
		}

	}

}
